{extend name="base" /}
{block name="body"} 
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
                <li class="layui-this">系统设置</li>
                <li>{:__('Sina email')}</li>
                <li>{:__('QQ')}</li>
                <li>{:__('Enterprise mailbox')}</li>
                <li>{:__('short messages')}</li>
            </ul>
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
                 <!--系统设置-->
                    <form action="{:url('system/edit',['model'=>'config_system_settings'])}" class="layui-form layui-form-pane" method="post"> 
     

         <div class="layui-form-item">
                   <label class="layui-form-label">默认图片</label>
                 <div class="layui-input-inline">
                        <div class="profile-avatar-container">
                  <img id="image" class="profile-user-img img-responsive" src="{$model.image}" alt="">
            <span class="layui-upload-list">
                   <div class="profile-avatar-text img-circle"><i class="layui-icon layui-icon-upload" style="font-size: 50px; color: #FF0000;"></i></div>
               <button type="button" id="ajax-admin-avatar"><i class="fa fa-upload"></i>{:__('Edit')}</button>
            </span>
            <span class="layui-upload-list" style="padding-left: 20px;"></span>
                       </div>
                   </div>
            <input type="hidden" name="filesize" id="filesize" value="">
            <input type="hidden" name="mine" id="mine" value="">
            <input type="hidden" name="image" value="">
           </div>

            
         <div class="layui-form-item">
            <label class="layui-form-label">网站标题</label>
             <div class="layui-input-inline">
                <input type="text" name="title" id="title" value="{$model.title|default=''}" lay-verify="required" placeholder="网站标题" autocomplete="off" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                      </div>
                   </div>  
         <div class="layui-form-item">
                <label class="layui-form-label">手机注册</label>
                <div class="layui-input-inline">
                    <input type="checkbox" name="mobile" title="是否开启手机注册" lay-filter="checkbox" {if isset($model.mobile) and $model.mobile == 1}checked{/if}>
                </div>
                <div lay-checkbox>
                    <input type="hidden" name="mobile" id="mobile" value="{$model.mobile|default=''}">
                </div> 
            </div> 
         <div class="layui-form-item">
            <label class="layui-form-label">邮箱注册</label>
             <div class="layui-input-inline">
                    <input type="checkbox" name="email" title="是否开启邮箱注册" lay-filter="checkbox" {if isset($model.email) and $model.email == 1}checked{/if}>
                </div>
              <div lay-checkbox>
                    <input type="hidden" name="email" id="email" value="{$model.email|default=''}">
                </div>
        </div> 
         <div class="layui-form-item">
            <label class="layui-form-label">前验证码</label> 
              <div class="layui-input-inline">
                    <input type="checkbox" name="useryzm" title="是否开启前端验证码" lay-filter="checkbox" {if isset($model.useryzm) and $model.useryzm == 1}checked{/if}>
                </div>
                <div lay-checkbox>
                    <input type="hidden" name="useryzm" id="useryzm" value="{$model.useryzm|default=''}">
                  </div>
        </div>  
         <div class="layui-form-item">
            <label class="layui-form-label">后验证码</label>
           <div class="layui-input-inline">
                    <input type="checkbox" name="adminyzm" title="是否开启后端验证码" lay-filter="checkbox" {if isset($model.adminyzm) and $model.adminyzm == 1}checked{/if}>
                </div>
                <div lay-checkbox>
                    <input type="hidden"name="adminyzm" id="adminyzm" value="{$model.adminyzm|default=''}">
                </div>
        </div> 
         <div class="layui-form-item">
                <label class="layui-form-label">多关键词</label>
                <div class="layui-input-inline">
                   
                    <textarea name="keywords" class="layui-textarea" placeholder="多个关键词用英文状态 , 号分割" style= "overflow:hidden;">{$model.keywords|default=''}</textarea>
                </div>
            </div>
         <div class="layui-form-item">
                <label class="layui-form-label">描&emsp;述</label>
              <div class="layui-input-inline">
                    <textarea name="description" class="layui-textarea" placeholder="多个关键词用英文状态 , 号分割" style= "overflow:hidden;">{$model.description|default=''}</textarea>
                </div>
            </div>
         <div class="layui-form-item">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-inline">
                    <input name="copyright" lay-verify="required" value="{$model.copyright|default=''}" placeholder="版权信息" class="layui-input" lay-verType="tips" lay-verify="required" required>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">客服手机</label>
                 <div class="layui-input-inline">
                    <input type="text" name="iphone" value="{$model.iphone|default=''}" placeholder="客服手机" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">备案信息</label>
                 <div class="layui-input-inline">
                    <input type="text" name="beian" value="{$model.beian|default=''}" placeholder="版权信息" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                </div>
            </div>
        <div class="layui-form-item">
           <div class="layui-input-block">
                <button class="layui-btn" lay-submit  lay-filter="save">确认保存</button>
            </div>
        </div>
    </form>
            </div>   
    <div class="layui-tab-item">   
       <!--// //新浪邮箱-->
        <form action="{:url('system/edit',['model'=>'config_sina_mail'])}" class="layui-form layui-form-pane" method="post">  
              <div class="layui-form-item">
                <label class="layui-form-label">开关</label>

                 <div class="layui-input-inline">
                    <input type="checkbox" name="sina" title="是否开启" lay-filter="checkbox" {if isset($sina.status) and $sina.status==1}checked{/if}>
                </div>
                <div lay-checkbox>
                    <input type="hidden" id="sina" name="status" id="status" value="{$sina.status|default=''}">
                </div>
            </div> 
                    <div class="layui-form-item">
                        <label class="layui-form-label">服务器</label>
                        <div class="layui-input-inline">
                            <input type="text" name="host" value="{$sina.host|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器地址</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号</label>
                        <div class="layui-input-inline">
                            <input type="text" name="email" value="{$sina.email|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器账号</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" value="{$sina.password|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器密码</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">端口</label>
                       <div class="layui-input-inline">
                            <input type="text" name="port" value="{$sina.port|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器端口,一般为465，25</div>
                    </div>
                    <div class="layui-form-item">
           <div class="layui-input-block">
                            <button class="layui-btn" lay-submit  lay-filter="save">新浪提交</button>
                        </div>
                    </div>
                    </form>
                </div>
    <div class="layui-tab-item">
        <!--//QQ邮箱-->
        <form action="{:url('system/edit',['model'=>'config_qq_mail'])}" class="layui-form layui-form-pane" method="post">  
      <div class="layui-form-item">
                <label class="layui-form-label">开关</label>
                <div class="layui-input-inline">
                <input type="radio" id="status" name="status" value="1" title="开启" {if isset($qq.status) and $qq.status==1}checked{/if}> 
                <input type="radio" id="status" name="status" value="0" title="关闭" {if isset($qq.status) and $qq.status==0}checked{/if}>
                </div>
            </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">服务器</label>
                        <div class="layui-input-inline">
                            <input type="text" name="host" value="{$qq.host|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器地址</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号</label>
                       <div class="layui-input-inline">
                            <input type="text" name="email" value="{$qq.email|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器账号</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                      <div class="layui-input-inline">
                            <input type="text" name="password" value="{$qq.password|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器密码</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">端口</label>
                       <div class="layui-input-inline">
                            <input type="text" name="port" value="{$qq.port|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器端口,一般为465，25</div>
                    </div>
                    <div class="layui-form-item">
           <div class="layui-input-block">
                            <button class="layui-btn" lay-submit  lay-filter="save">QQ提交</button>
                        </div>
                    </div>
                    </form>
                </div>
    <div class="layui-tab-item">
             <!--//腾讯企业邮箱-->
              <form action="{:url('system/edit',['model'=>'config_enterprise_email'])}" class="layui-form layui-form-pane" method="post">   
       <div class="layui-form-item">
                <label class="layui-form-label">开关</label>
                <div class="layui-input-inline">
                    <input type="hidden" id="enterprise" name="status" value="{$enterprise.status|default=''}" id="status">
                <input type="checkbox" name="enterprise" title="选中" lay-filter="checkbox" lay-skin="tag" {if isset($enterprise.status) and $enterprise.status==1}checked{/if}> 
                </div>
            </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">服务器</label>
                       <div class="layui-input-inline">
                            <input type="text" name="host" value="{$enterprise.host|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器地址</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号</label>
                        <div class="layui-input-inline">
                            <input type="text" name="email" value="{$enterprise.email|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器账号</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" value="{$enterprise.password|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器密码</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">端口</label>
                        <div class="layui-input-inline">
                            <input type="text" name="port" value="{$enterprise.port|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">服务器端口,一般为465，25</div>
                    </div>
                    <div class="layui-form-item">
           <div class="layui-input-block">
                            <button class="layui-btn" lay-submit  lay-filter="save">腾讯提交</button>
                        </div>
                    </div>
                    </form>
         </div>
    <div class="layui-tab-item">
 <form action="{:url('system/edit',['model'=>'config_sms'])}" class="layui-form layui-form-pane" method="post">   
                  <div class="layui-form-item">
                <label class="layui-form-label">开关</label>
                <div class="layui-input-inline">
                    <input type="hidden" id="sms" name="status" value="{$sms.status|default=''}" id="status">
                <input type="checkbox" name="sms" title="选中" lay-filter="checkbox" lay-skin="tag" {if isset($sms.status) and $sms.status==1}checked{/if}> 
                </div>
            </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">短信地址</label>
                        <div class="layui-input-inline">
                            <input type="text" name="url" value="{$sms.url|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">短信登录地址。一般用于后台登入</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">用户名</label>
                       <div class="layui-input-inline">
                            <input type="text" name="name" value="{$sms.name|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">短信宝注册用户名</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" value="{$sms.password|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">短信宝登录密码</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">API Key</label>
                        <div class="layui-input-inline">
                            <input type="text" name="key" value="{$sms.key|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">短信宝API Key，登录后可查看</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">模板</label>
                        <div class="layui-input-inline">
                            <input type="text" name="moban" value="{$sms.moban|default=''}" class="layui-input" lay-verType="tips" lay-verify="required" required/>
                        </div>
              <div class="layui-form-mid layui-word-aux">不可修改。</div>
                    </div>
                    <div class="layui-form-item">
           <div class="layui-input-block">
                            <button class="layui-btn" lay-submit  lay-filter="save">短信提交</button>
                        </div>
                    </div>
                    </form>
         </div>
  </div>
</div>
{/block} 
{block name="js"}
<script>
layui.use(function () {

             var upload = layui.upload;
             var form = layui.form;
             var $  = layui.jquery;        
             form.render();
// 头像上传
      var uploadInst = upload.render({
    elem: '#ajax-admin-avatar',
            exts: 'jpg|png|jpeg|gif|svg',
            size: 2048,
    url: "{:url('upload/uploadImage',['model'=>'5'])}", //Change to your own upload interface //改成您自己的上传接口
    done: function (result) {
        // 上传完毕回调
        if (result.code === 1) {
            $('#image').attr('src', result.url);
            //this.item.prev('input').val(result.url);
            $('input[name="image"]').val(result.url);
            $('input[name="filesize"]').val(result.filesize);
            $('input[name="mine"]').val(result.mine);
            layer.msg(result.msg, {icon: 1});
        } else {
            layer.msg(result.msg, {icon: 2});
        }
    }
        });

}); 
   form.on('checkbox(checkbox)', function(data){
          var status = $(this).attr('name')
                //console.log(status);   // 得到当前的Tab大容器
        if(data.elem.checked == true){
            $('#'+status).show();
            $('#'+status).attr('value','1');
        }else{
            $('#'+status).show();
            $('#'+status).attr('value','0');
        }
    });
        //监听Tab切换
  element.on('tab(docDemoTabBrief)', function(data){
    layer.tips('切换了 '+ data.index +'：'+ this.innerHTML, this, {
      tips: 2
    });
  });
</script>
{/block}
